#!/usr/bin/perl

# substitute version number
$ver = `/usr/local/bin/svnversion -n .`;
($ver =~ m/\d+[MS]*$/) && ($ver = $&);

$lastVer = "";
if (-e "svnversion") {
    $lastVer = `cat svnversion`;
    $lastVer =~ s/[\r\n]//g;
}

if ($lastVer == $ver) {
    exit 0;
}

exec `echo $ver > svnversion`;
